package com.zhuang.nio.c1;

import java.nio.ByteBuffer;

/**
 * description: TestByteBufferReadWrite
 * date: 2022/12/12 10:02
 * author: Zhuang
 * version: 1.0
 */
public class TestByteBufferReadWrite {
    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(10);
        buffer.put((byte) 0x61);
        ByteBufferUtil.debugAll(buffer);
        buffer.put(new byte[]{0x62, 0x63, 0x64});
        ByteBufferUtil.debugAll(buffer);
        System.out.println(buffer.get());
        buffer.flip();
        System.out.println(buffer.get());
        ByteBufferUtil.debugAll(buffer);
        buffer.compact();
        ByteBufferUtil.debugAll(buffer);
        buffer.put(new byte[]{0x65,0x6f});
        ByteBufferUtil.debugAll(buffer);
    }
}
